package IO流_序列化流.对象字节输出流;

import java.io.Serializable;

// 注意: 这样直接运行会报错, Java规定: 要实现对象序列化,则对象必须实现Serializable类
public class User implements Serializable {
    private String loginName;
    private String userName;
    private int age;
    private transient String passWord;// 注意: 在这里用transient修饰后, 该对象的这个类不参与序列化

    @Override
    public String toString() {
        return "User{" +
                "loginName='" + loginName + '\'' +
                ", userName='" + userName + '\'' +
                ", age=" + age +
                ", passWord='" + passWord + '\'' +
                '}';
    }

    public String getLoginName() {
        return loginName;
    }

    public void setLoginName(String loginName) {
        this.loginName = loginName;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getPassWord() {
        return passWord;
    }

    public void setPassWord(String passWord) {
        this.passWord = passWord;
    }

    public User(String loginName, String userName, int age, String passWord) {
        this.loginName = loginName;
        this.userName = userName;
        this.age = age;
        this.passWord = passWord;
    }

    public User() {
    }
}
